package com.chen.service.dept;

import com.chen.dao.DeptMapper;
import com.chen.pojo.Court;
import com.chen.pojo.Dept;
import com.chen.vo.DeptVo;

import java.util.Date;
import java.util.List;

public class DeptServiceImpl implements DeptService {
    //service 调用  dao层
    private DeptMapper deptMapper;

    //set方法，spring注入
    public void setDeptMapper(DeptMapper deptMapper) {
        this.deptMapper = deptMapper;
    }

    public List<Dept> queryAllDept(DeptVo deptVo) {
        return deptMapper.queryAllDept(deptVo);
    }

    public int addDept(Dept dept) {
        //保存创建时间
        dept.setCreateTime(new Date());
        return deptMapper.addDept(dept);
    }

    public int updateDept(Dept dept) {
        dept.setCreateTime(new Date());
        return deptMapper.updateDept(dept);
    }

    public int deleteById(int id) {
        return deptMapper.deleteById(id);
    }

    public List<Dept> queryDept() {
        return deptMapper.queryDept();
    }
}
